package cn.yangliu.jpa.entity;

import cn.yangliu.comm.entity.BaseObject;

import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * 作者 杨柳
 * 创建时间 2017-08-26 21:27
 */
@MappedSuperclass
public abstract class BaseBean extends BaseObject{
    private Long id;

    private LocalDateTime updateTime;

    private LocalDateTime createTime;

    private Boolean flag = true;

    private String remark;

    @Transient
    private LocalDateTime dateTimeStart;
    @Transient
    private LocalDateTime dateTimeEnd;
    @Transient
    private LocalDate dateStart;
    @Transient
    private LocalDate dateEnd;
    @Transient
    private LocalTime timeStart;
    @Transient
    private LocalTime timeEnd;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Boolean getFlag() {
        return flag;
    }

    public void setFlag(Boolean flag) {
        this.flag = flag;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public LocalDateTime getDateTimeStart() {
        return dateTimeStart;
    }

    public void setDateTimeStart(LocalDateTime dateTimeStart) {
        this.dateTimeStart = dateTimeStart;
    }

    public LocalDateTime getDateTimeEnd() {
        return dateTimeEnd;
    }

    public void setDateTimeEnd(LocalDateTime dateTimeEnd) {
        this.dateTimeEnd = dateTimeEnd;
        /*if (dateTimeEnd != null) {
            this.dateTimeEnd = LocalDateTime.of(dateTimeEnd.toLocalDate(), LocalTime.MAX);
        }*/
    }

    public LocalDate getDateStart() {
        return dateStart;
    }

    public void setDateStart(LocalDate dateStart) {
        this.dateStart = dateStart;
    }

    public LocalDate getDateEnd() {
        return dateEnd;
    }

    public void setDateEnd(LocalDate dateEnd) {
        this.dateEnd = dateEnd;
        if (dateEnd != null) {
            this.dateEnd = dateEnd.plusDays(1L);
        }

    }

    public LocalTime getTimeStart() {
        return timeStart;
    }

    public void setTimeStart(LocalTime timeStart) {
        this.timeStart = timeStart;
    }

    public LocalTime getTimeEnd() {
        return timeEnd;
    }

    public void setTimeEnd(LocalTime timeEnd) {
        this.timeEnd = timeEnd;
    }
}
